package com.battleship.modelo;

public class Barco {

	private int longitud;

	private int posIni[] = { -1, -1 };
	private int posFin[] = { -1, -1 };

	private int boundLeft = 0;
	private int boundTop = 0;
	private int boundRight = 0;
	private int boundBottom = 0;

	private int[] tocado;

	public Barco() {
		this.longitud = 0;
		this.tocado = new int[longitud];
	}

	public boolean isIn(int x, int y) {
		if (this.boundLeft < x && this.boundRight > x && this.boundTop < y
				&& this.boundBottom > y) {
			return true;
		}
		return false;
	}
	public void rotate() {
		int newRigh = boundLeft + (boundBottom-boundTop);
		int newBottom = boundTop + (boundRight - boundLeft);
		this.boundRight = newRigh;
		this.boundBottom = newBottom;
	}
	public void move(int x, int y) {
		this.boundLeft += x;
		this.boundTop += y;
		this.boundRight += x;
		this.boundBottom += y;
	}

	public Barco(Barco barco) {
		this.longitud = barco.getLongitud();
		this.posIni = barco.getPosIni();
		this.posFin = barco.getPosFin();
		this.tocado = barco.getTocado();
	}

	public Barco(int longitud, int posIni[], int posFin[], int[] tocado) {
		this.longitud = longitud;
		this.posIni = posIni;
		this.posFin = posFin;
		this.tocado = tocado;
	}

	public int getLongitud() {
		return longitud;
	}

	public void setLongitud(int longitud) {
		this.longitud = longitud;
		this.tocado = new int[longitud];
	}

	public int[] getPosIni() {
		return posIni;
	}

	public void setPosIni(int[] posIni) {
		this.posIni = posIni;
	}

	public int[] getPosFin() {
		return posFin;
	}

	public void setPosFin(int[] posFin) {
		this.posFin = posFin;
	}

	public int[] getTocado() {
		return tocado;
	}

	public void setTocado(int[] tocado) {
		this.tocado = tocado;
	}

	public int getBoundLeft() {
		return boundLeft;
	}

	public void setBoundLeft(int boundLeft) {
		this.boundLeft = boundLeft;
	}

	public int getBoundTop() {
		return boundTop;
	}

	public void setBoundTop(int boundTop) {
		this.boundTop = boundTop;
	}

	public int getBoundRight() {
		return boundRight;
	}

	public void setBoundRight(int boundRight) {
		this.boundRight = boundRight;
	}

	public int getBoundBottom() {
		return boundBottom;
	}

	public void setBoundBottom(int boundBottom) {
		this.boundBottom = boundBottom;
	}

}
